package org.jeecgframework.web.service;

import org.jeecgframework.core.common.model.json.AjaxJson;
import org.jeecgframework.core.common.model.json.Highchart;
import org.jeecgframework.core.common.service.CommonService;
import org.jeecgframework.web.system.pojo.base.CbsDelinerEntity;
import org.jeecgframework.web.system.pojo.base.TSUser;
import org.quartz.Scheduler;
import org.quartz.SchedulerException;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.Serializable;
import java.text.ParseException;
import java.util.List;
import java.util.Map;

public interface CbsDelinerServiceI extends CommonService {

    public <T> void delete(T entity);

    public <T> Serializable save(T entity);

    public <T> void saveOrUpdate(T entity);

    /**
     * 默认按钮-sql增强-新增操作
     *
     * @param id
     * @return
     */
    public boolean doAddSql(CbsDelinerEntity t);

    /**
     * 默认按钮-sql增强-更新操作
     *
     * @param id
     * @return
     */
    public boolean doUpdateSql(CbsDelinerEntity t);

    /**
     * 默认按钮-sql增强-删除操作
     *
     * @param id
     * @return
     */
    public boolean doDelSql(CbsDelinerEntity t);

    /**
     * 发送邮件
     */
    void sendMail(CbsDelinerEntity deliver, TSUser user, String type, String emailTitle, String ftl);

    /**
     * 发送短信
     */
    void sendMsg(CbsDelinerEntity deliver, TSUser user, String type, String ftl);

    /*
     * 导出excel
     * */
    void exportDeliverList(HttpServletRequest request, HttpServletResponse response);

    /*
     * 导出excel
     * */
    void exportDeliverListForLogistics(HttpServletRequest request, HttpServletResponse response);

    /**
     * 计算服务等级
     **/
    Map<String, Object> ifQualifiedLevel(String minTime, String maxTime, String slaType) throws ParseException;

    /*
     * 添加发货单操作日志
     * description:操作描述
     * businessId:业务id
     * */
    public void addDeliverLog(String description, String businessId, int processStatus);

    public void taskTimeTest(Scheduler sched, String triggerName, String triggerGroupName, String time) throws SchedulerException;

    //两个小时之后   状态依然为物流待发货
    public void getDeliverIsDfh();

    //物流发货绩效报表
    public List<Map<String, Object>> getDeliverAging(String deliverLogistics, String sendType, String month, String week, String startTime, String endTime);

    //
    public List<Highchart> getCharData(String deliverLogistics, String sendType, String month, String week, String startTime, String endTime);

    //某个物流下Gross的百分比
    public List<Highchart> toStatisticalShipment(String name, String slaType, String type, String yue, String week, String startTime, String endTime, boolean b) throws Exception;

    //查询某个物流下Net的百分比
    public List<Highchart> getSl2Percentage(String deliverLogticis, String slaType, String yue, String week, String startTime, String endTime, boolean b) throws Exception;

    //
    public void exportCbsDeliverReport(HttpServletRequest request, HttpServletResponse response);

    /**
     * 生成发货单号
     * @return
     */
    public String getDelinerCode();

    /**
     * CSA发货
     * @param cbsDelinerEntity
     * @param request
     * @return
     */
    public AjaxJson sendHuo(CbsDelinerEntity cbsDelinerEntity, HttpServletRequest request);

    /**
     * CSA取消发货
     * @param request
     * @return
     */
    public AjaxJson removeDeliver(HttpServletRequest request);

    /**
     * CSA标记欠货
     * @param request
     * @return
     */
    public AjaxJson addQH(HttpServletRequest request);

    public String getUuid();
    public String getReturnCode();

    /**
     * @Author X On 2018/11/12 10:40
     * @Description Net || Gross 当只选择发货时间范围查询时 或者 三个条件都是空的情况 采用单独的查询方式（后期 如果 周报和 月报查询 单独区分开来 就只调用这个方法就可以）
     * @param type 视图类型 Net / Gross
     * @param slaType 时效类型 SL1 / SL2
     * @param startTime 通知发货开始时间
     * @param endTime 通知发货结束时间
     */
    List<Highchart> getDeliverData(String type, String slaType, String startTime, String endTime);

}
